package com.aaa.mrcai.controller;

import com.aaa.mrcai.annotion.AAALog;
import com.aaa.mrcai.pojo.entity.State;
import com.aaa.mrcai.pojo.vo.AreaStateVO;
import com.aaa.mrcai.pojo.vo.AreaVO;
import com.aaa.mrcai.query.AreaQuery;
import com.aaa.mrcai.result.AjaxResult;
import com.aaa.mrcai.service.AreaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author meowyf
 * @version 1.0
 * @Name Z_MJ
 * @date 2021/12/05 18:15:20
 */
@RestController
@RequestMapping("area")
public class AreaController {
    @Autowired
    private AreaService areaService;

    @RequestMapping("listState")
    public AjaxResult listState(){

        return areaService.listState();
    }

    @RequestMapping("list")
    public AjaxResult list(AreaQuery areaQuery){

        return areaService.list(areaQuery);
    }

    @RequestMapping("location")
    public AjaxResult location(){

        return areaService.location();
    }

    @RequestMapping("admin")
    public AjaxResult admin(){

        return areaService.admin();
    }

    @RequestMapping("addArea")
    @AAALog("添加区域")
    public AjaxResult addArea(AreaVO areaVO){
        System.out.println("aaa"+areaVO);
        return areaService.addArea(areaVO);
    }

    @RequestMapping("updateState")
    @AAALog("更改区域状态为0")
    public AjaxResult updateState(AreaStateVO areaStateVO){

        return areaService.updateState(areaStateVO);
    }

    @RequestMapping("updateStateTWO")
    @AAALog("更改区域状态为1")
    public AjaxResult updateStateTWO(AreaStateVO areaStateVO){

        return areaService.updateStateTWO(areaStateVO);
    }
}
